package main

import (
	"fmt"
	"net/http"
)

func greeting(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Welcome, Gopher!\n")
}

func main() {
	// http.ListenAndServe(addr string, handler http.Handler) error{}
	// http.HandlerFunc 是一个函数类型，实现了接口 http.Handler
	// 这里将函数 greeting 显式转换成 http.HandlerFunc 类型
	http.ListenAndServe(":8080", http.HandlerFunc(greeting))
}
